package com.mall.tag;

import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import com.mall.ibatis.bean.Method;

@SuppressWarnings("serial")
public class MethodFilterTag extends TagSupport {
	private List<Method> list;

	public List<Method> getList() {
		return list;
	}

	public void setList(List<Method> list) {
		this.list = list;
	}
	
	public int doStartTag() throws JspException
	{
		try
		{
			JspWriter out = pageContext.getOut();
						
			for(Method s : list){
				boolean f = s.getNum().equals(s.getNum2());
				//s.getNum是方法编码作为变量。如果和Num2里面值相等则勾选了该方法
				out.println("var " + "p_" + s.getNum() + " = " + f + ";");
				
			}
							
			out.flush();
		}
		catch (Exception e)
		{
			// TODO: handle exception
			throw new JspTagException(e.getMessage());
		}
		
		
		return SKIP_BODY;
	}
	
}
